{% extends "admin/layout.html" %}

{% block css %}
    <link rel="stylesheet" type="text/css" href="{{ url_for('static',filename="jwplayer/skins/stormtrooper.css")}}">
{% endblock %}

{% block content %}
<section class="content-header">
    <h1>微电影管理系统</h1>
    <ol class="breadcrumb">
        <li><a href="{{ url_for('admin.movie_list',page=1) }}"><i class="fa fa-dashboard"></i> 电影管理</a></li>
        <li class="active">编辑电影</li>
    </ol>
</section>
<section class="content" id="showcontent">
    <div class="row">
        <div class="col-md-12">
            <div class="box box-primary">
                <div class="box-header with-border">
                    <h3 class="box-title">编辑电影</h3>
                </div>
                <form role="form" method="post" enctype="multipart/form-data">
                    <div class="box-body">
                        {% include "admin/layout/flash_message.html" %}
                        <div class="form-group">
                            <label for="input_title">{{ form.title.label }}</label>
                            {{ form.title(value=movie.title) }}
                            {% include "admin/layout/title_error.html" %}
                        </div>

                        <div class="form-group">
                            <label for="input_url">{{ form.url.label }}</label>
                            {{ form.url }}
                            <div style="margin-top:5px;">
                                <div id="moviecontainer"></div>
                            </div>
                            {% include "admin/layout/url_error.html" %}
                        </div>
                        <div class="form-group">
                            <label for="input_info">{{ form.info.label }}</label>
                            {{ form.info }}
                            {% include "admin/layout/info_error.html" %}
                        </div>
                        <div class="form-group">
                            <label for="input_logo">{{ form.logo.label }}</label>
                            {{ form.logo }}
                            <img src="{{ url_for('static',filename='uploads/'+movie.logo) }}" style="margin-top:5px;" class="img-responsive"
                                 alt="">
                            {% include "admin/layout/logo_error.html" %}
                        </div>
                        <div class="form-group">
                            <label for="input_star">{{ form.star.label }}</label>
                            {{ form.star }}
                            {% include "admin/layout/star_error.html" %}
                        </div>
                        <div class="form-group">
                            <label for="input_tag_id">{{ form.tag_id.label }}</label>
                            {{ form.tag_id }}
                            {% include "admin/layout/tag_id_error.html" %}
                        </div>
                        <div class="form-group">
                            <label for="input_area">{{ form.area.label }}</label>
                            {{ form.area(value=movie.area) }}
                            {% include "admin/layout/area_error.html" %}
                        </div>
                        <div class="form-group">
                            <label for="input_length">{{ form.length.label }}</label>
                            {{ form.length(value=movie.length) }}
                            {% include "admin/layout/length_error.html" %}
                        </div>
                        <div class="form-group">
                            <label for="input_release_time">{{ form.release_time.label }}</label>
                            {{ form.release_time(value=movie.release_time) }}
                            {% include "admin/layout/release_time_error.html" %}
                        </div>
                    </div>
                    <div class="box-footer">
                        {{ form.csrf_token }}
                        {{ form.submit }}
                    </div>
                </form>
            </div>
        </div>
    </div>
</section>
{% endblock %}

{% block js %}
    <script src="{{ url_for('static',filename="")}}../static/jwplayer/jwplayer.js"></script>
    <script>
        jwplayer.key = "P9VTqT/X6TSP4gi/hy1wy23BivBhjdzVjMeOaQ==";
        jwplayer("moviecontainer").setup({
        flashplayer: "{{ url_for('static',filename='jwplayer/jwplayer.flash.swf')}}",
        playlist: [{
            file: "{{ url_for('static',filename='uploads/'+movie.url) }}",
            title: "{{ movie.title }}"
        }],
        modes: [{
            type: "html5"
        }, {
            type: "flash",
            src: "{{ url_for('static',filename="jwplayer/jwplayer.flash.swf")}}"
        }, {
            type: "download"
        }],
        skin: {
            name: "vapor"
        },
        "playlist.position": "left",
        "playlist.size": 200,
        height: 250,
        width: 387,
    });
        $(document).ready(function(){
        $('#input_release_time').datepicker({
            autoclose: true,
            format: 'yyyy-mm-dd',
            language: 'zh-CN',
        });
    });
        $(function(){
            $('#a-3').addClass("active");
            $('#a-3-1').addClass("active");
        })
    </script>
{% endblock %}